<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="店铺名称" prop="shopName">
        <el-input
          v-model="queryParams.shopName"
          placeholder="请输入店铺名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="店铺负责人" prop="shopUser">
        <el-input
          v-model="queryParams.shopUser"
          placeholder="请输入店铺负责人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['marketers:MarketersApply:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['marketers:MarketersApply:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['marketers:MarketersApply:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['marketers:MarketersApply:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="MarketersApplyList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="ID" align="center" prop="shopsId"/>
      <el-table-column label="店铺名称" align="center" prop="shopName"/>
      <el-table-column label="logo" align="center" prop="shopLogo" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.shopLogo" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="店铺负责人" align="center" prop="shopUser"/>
      <el-table-column label="主要产品" align="center" prop="mainProducts"/>
      <el-table-column label="店铺地址" align="center" prop="shopUrl"/>
<!--      <el-table-column label="状态 " align="center" prop="shopStatus">
        <template slot-scope="scope">
          <dict-tag :options="scope.row.shopStatus" :value="scope.row.shopStatus"/>
        </template>
      </el-table-column>-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['marketers:MarketersApply:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['marketers:MarketersApply:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改商家审核对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="店铺名称" prop="shopName">
          <el-input v-model="form.shopName" placeholder="请输入店铺名称"/>
        </el-form-item>
        <el-form-item label="logo" prop="shopLogo">
          <image-upload v-model="form.shopLogo"/>
        </el-form-item>
        <el-form-item label="店铺负责人" prop="shopUser">
          <el-input v-model="form.shopUser" placeholder="请输入店铺负责人"/>
        </el-form-item>
        <el-form-item label="主要产品" prop="mainProducts">
          <el-input v-model="form.mainProducts" placeholder="请输入主要产品"/>
        </el-form-item>
        <el-form-item label="店铺地址" prop="shopUrl">
          <el-input v-model="form.shopUrl" placeholder="请输入店铺地址"/>
        </el-form-item>
        <el-form-item label="详细地址" prop="shopAddress">
          <el-input v-model="form.shopAddress" placeholder="请输入详细地址"/>
        </el-form-item>
        <el-form-item label="店铺简介" prop="shopIntroduction">
          <el-input v-model="form.shopIntroduction" placeholder="请输入店铺简介"/>
        </el-form-item>


        <!--        <el-form-item label="理由" prop="rejectReason">-->
        <!--&lt;!&ndash;          <template slot-scope="scope">&ndash;&gt;-->
        <!--            <el-input v-model="form.rejectReason" placeholder="请输入驳回理由" />-->
        <!--&lt;!&ndash;          </template>&ndash;&gt;-->
        <!--        </el-form-item>-->


        <!--        <el-form-item label="银行开户名" prop="bankAccountName">-->
        <!--          <el-input v-model="form.bankAccountName" placeholder="请输入银行开户名" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="银行账号" prop="bankAccount">-->
        <!--          <el-input v-model="form.bankAccount" placeholder="请输入银行账号" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="开户行支行名称" prop="subBranch">-->
        <!--          <el-input v-model="form.subBranch" placeholder="请输入开户行支行名称" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="支行联行号" prop="lineNumber">-->
        <!--          <el-input v-model="form.lineNumber" placeholder="请输入支行联行号" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="法人姓名" prop="legalPersonName">-->
        <!--          <el-input v-model="form.legalPersonName" placeholder="请输入法人姓名" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="法人证件号" prop="legalPersonDocument">-->
        <!--          <el-input v-model="form.legalPersonDocument" placeholder="请输入法人证件号" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="法人身份证照片" prop="legalPersonImage">-->
        <!--          <image-upload v-model="form.legalPersonImage"/>-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="公司名称" prop="corporateName">-->
        <!--          <el-input v-model="form.corporateName" placeholder="请输入公司名称" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="公司地址" prop="corporateUrl">-->
        <!--          <el-input v-model="form.corporateUrl" placeholder="请输入公司地址" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="公司详细地址" prop="corporateAddress">-->
        <!--          <el-input v-model="form.corporateAddress" placeholder="请输入公司详细地址" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="员工总数" prop="corporateCount">-->
        <!--          <el-input v-model="form.corporateCount" placeholder="请输入员工总数" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="公司电话" prop="corporatePhone">-->
        <!--          <el-input v-model="form.corporatePhone" placeholder="请输入公司电话" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="注册资金" prop="registeredCapital">-->
        <!--          <el-input v-model="form.registeredCapital" placeholder="请输入注册资金" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="联系人姓名" prop="contactName">-->
        <!--          <el-input v-model="form.contactName" placeholder="请输入联系人姓名" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="联系人电话" prop="contactPhone">-->
        <!--          <el-input v-model="form.contactPhone" placeholder="请输入联系人电话" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="公司邮箱" prop="contactEmail">-->
        <!--          <el-input v-model="form.contactEmail" placeholder="请输入公司邮箱" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="营业执照号" prop="licenseNumber">-->
        <!--          <el-input v-model="form.licenseNumber" placeholder="请输入营业执照号" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="法定经营范围" prop="businessScope">-->
        <!--          <el-input v-model="form.businessScope" placeholder="请输入法定经营范围" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="营业执照电子版" prop="shopELicense">-->
        <!--          <image-upload v-model="form.shopELicense"/>-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="状态 " prop="status">-->
        <!--          <el-select v-model="form.status" placeholder="请选择状态 ">-->
        <!--            <el-option-->
        <!--              v-for="dict in dict.type.check_status"-->
        <!--              :key="dict.value"-->
        <!--              :label="dict.label"-->
        <!--              :value="parseInt(dict.value)"-->
        <!--            ></el-option>-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <!--        <el-divider content-position="center">商家店铺信息</el-divider>-->
        <!--        <el-row :gutter="10" class="mb8">-->
        <!--          <el-col :span="1.5">-->
        <!--            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMarketersShop">添加</el-button>-->
        <!--          </el-col>-->
        <!--          <el-col :span="1.5">-->
        <!--            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMarketersShop">删除</el-button>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <!--        <el-table :data="marketersShopList" :row-class-name="rowMarketersShopIndex" @selection-change="handleMarketersShopSelectionChange" ref="marketersShop">-->
        <!--          <el-table-column type="selection" width="50" align="center" />-->
        <!--          <el-table-column label="序号" align="center" prop="index" width="50"/>-->
        <!--          <el-table-column label="店铺名称" prop="shopName" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopName" placeholder="请输入店铺名称" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店长用户名" prop="shopUser" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopUser" placeholder="请输入店长用户名" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺logo" prop="shopLogo" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopLogo" placeholder="请输入店铺logo" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺地址" prop="shopUrl" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopUrl" placeholder="请输入店铺地址" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="详细地址" prop="shopAddress" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopAddress" placeholder="请输入详细地址" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺类型" prop="shopType" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-select v-model="scope.row.shopType" placeholder="请选择店铺类型">-->
        <!--                <el-option label="请选择字典生成" value="" />-->
        <!--              </el-select>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺状态" prop="shopStatus" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-select v-model="scope.row.shopStatus" placeholder="请选择店铺状态">-->
        <!--                <el-option label="请选择字典生成" value="" />-->
        <!--              </el-select>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="是否自营" prop="isSelf" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.isSelf" placeholder="请输入是否自营" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺联系人" prop="shopPhone" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopPhone" placeholder="请输入店铺联系人" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="电子邮件" prop="shopEmail" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopEmail" placeholder="请输入电子邮件" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="审核通过时间" prop="shopApprovedAt" width="240">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-date-picker clearable v-model="scope.row.shopApprovedAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择审核通过时间" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="订单编号" prop="orderId" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.orderId" placeholder="请输入订单编号" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="营业时间" prop="openingHours" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.openingHours" placeholder="请输入营业时间" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="营业执照" prop="shopLicense" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopLicense" placeholder="请输入营业执照" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺规模" prop="shopSize" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopSize" placeholder="请输入店铺规模" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="主营产品" prop="mainProducts" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.mainProducts" placeholder="请输入主营产品" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="副营产品" prop="otherProducts" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.otherProducts" placeholder="请输入副营产品" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="通过审核的审核员ID" prop="shopApprovedBy" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopApprovedBy" placeholder="请输入通过审核的审核员ID" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺描述:" prop="shopDescription" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopDescription" placeholder="请输入店铺描述:" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺门面:" prop="shopFacade" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopFacade" placeholder="请输入店铺门面:" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="店铺简介" prop="shopIntroduction" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopIntroduction" placeholder="请输入店铺简介" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="银行开户名" prop="bankAccountName" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.bankAccountName" placeholder="请输入银行开户名" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="银行账号" prop="bankAccount" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.bankAccount" placeholder="请输入银行账号" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="开户行支行名称" prop="subBranch" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.subBranch" placeholder="请输入开户行支行名称" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="支行联行号" prop="lineNumber" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.lineNumber" placeholder="请输入支行联行号" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="法人姓名" prop="legalPersonName" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.legalPersonName" placeholder="请输入法人姓名" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="法人证件号" prop="legalPersonDocument" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.legalPersonDocument" placeholder="请输入法人证件号" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="公司名称" prop="corporateName" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.corporateName" placeholder="请输入公司名称" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="公司电话" prop="corporatePhone" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.corporatePhone" placeholder="请输入公司电话" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="公司所在地" prop="corporateUrl" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.corporateUrl" placeholder="请输入公司所在地" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="公司详细地址" prop="corporateAddress" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.corporateAddress" placeholder="请输入公司详细地址" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="员工总数" prop="corporateCount" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.corporateCount" placeholder="请输入员工总数" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="注册资金" prop="registeredCapital" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.registeredCapital" placeholder="请输入注册资金" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="联系人姓名" prop="contactName" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.contactName" placeholder="请输入联系人姓名" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="联系人电话" prop="contactPhone" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.contactPhone" placeholder="请输入联系人电话" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="电子邮箱" prop="contactEmail" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.contactEmail" placeholder="请输入电子邮箱" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="营业执照号" prop="licenseNumber" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.licenseNumber" placeholder="请输入营业执照号" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="法定经营范围" prop="businessScope" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.businessScope" placeholder="请输入法定经营范围" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="营业执照电子版" prop="shopELicense" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.shopELicense" placeholder="请输入营业执照电子版" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="驳回理由" prop="rejectReason" width="150">-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-input v-model="scope.row.rejectReason" placeholder="请输入驳回理由" />-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--        </el-table>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listMarketersApply,
  getMarketersApply,
  delMarketersApply,
  addMarketersApply,
  updateMarketersApply
} from "@/api/marketers/marketersApply";

export default {
  name: "MarketersApply",
  dicts: ['check_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedMarketersShop: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 商家审核表格数据
      MarketersApplyList: [],
      // 商家店铺表格数据
      marketersShopList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        // shopName: null,
        shopUser: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        shopName: [
          {required: true, message: "店铺名称不能为空", trigger: "blur"}
        ],
        shopAddress: [
          {required: true, message: "详细地址不能为空", trigger: "blur"}
        ],
        status: [
          {required: true, message: "状态 不能为空", trigger: "change"}
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询商家审核列表 */
    getList() {
      this.loading = true;
      listMarketersApply(this.queryParams).then(response => {
        this.MarketersApplyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        shopsId: null,
        shopName: null,
        shopLogo: null,
        shopUser: null,
        mainProducts: null,
        shopUrl: null,
        shopAddress: null,
        shopIntroduction: null,
        bankAccountName: null,
        bankAccount: null,
        subBranch: null,
        lineNumber: null,
        legalPersonName: null,
        legalPersonDocument: null,
        legalPersonImage: null,
        corporateName: null,
        corporateUrl: null,
        corporateAddress: null,
        corporateCount: null,
        corporatePhone: null,
        registeredCapital: null,
        contactName: null,
        contactPhone: null,
        contactEmail: null,
        licenseNumber: null,
        businessScope: null,
        shopELicense: null,
        status: null
      };
      // this.marketersShopList = [];
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.applyId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加店铺";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const shopsId = row.shopsId || this.ids
      getMarketersApply(shopsId).then(response => {
        this.form = response;
        console.log(this.form)
        // this.marketersShopList = response.data.marketersShopList;
        this.open = true;
        this.title = "店铺信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.marketersShopList = this.marketersShopList;
          if (this.form.applyId != null) {
            updateMarketersApply(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addMarketersApply(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      console.log('row')
      const shopsId = row.shopsId || this.ids;
      this.$modal.confirm('是否确认删除商家审核编号为"' + shopsId + '"的数据项？').then(function () {
        return delMarketersApply(shopsId);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 商家店铺序号 */
    rowMarketersShopIndex({row, rowIndex}) {
      row.index = rowIndex + 1;
    },
    /** 商家店铺添加按钮操作 */
    handleAddMarketersShop() {
      let obj = {};
      obj.shopName = "";
      obj.shopUser = "";
      obj.shopLogo = "";
      obj.shopUrl = "";
      obj.shopAddress = "";
      obj.shopType = "";
      obj.shopStatus = "";
      obj.isSelf = "";
      obj.shopPhone = "";
      obj.shopEmail = "";
      obj.shopApprovedAt = "";
      obj.orderId = "";
      obj.openingHours = "";
      obj.shopLicense = "";
      obj.shopSize = "";
      obj.mainProducts = "";
      obj.otherProducts = "";
      obj.shopApprovedBy = "";
      obj.shopDescription = "";
      obj.shopFacade = "";
      obj.shopIntroduction = "";
      obj.bankAccountName = "";
      obj.bankAccount = "";
      obj.subBranch = "";
      obj.lineNumber = "";
      obj.legalPersonName = "";
      obj.legalPersonDocument = "";
      obj.legalPersonImage = "";
      obj.corporateName = "";
      obj.corporatePhone = "";
      obj.corporateUrl = "";
      obj.corporateAddress = "";
      obj.corporateCount = "";
      obj.registeredCapital = "";
      obj.contactName = "";
      obj.contactPhone = "";
      obj.contactEmail = "";
      obj.licenseNumber = "";
      obj.businessScope = "";
      obj.shopELicense = "";
      obj.rejectReason = "";
      this.marketersShopList.push(obj);
    },
    /** 商家店铺删除按钮操作 */
    handleDeleteMarketersShop() {
      if (this.checkedMarketersShop.length == 0) {
        this.$modal.msgError("请先选择要删除的商家店铺数据");
      } else {
        const marketersShopList = this.marketersShopList;
        const checkedMarketersShop = this.checkedMarketersShop;
        this.marketersShopList = marketersShopList.filter(function (item) {
          return checkedMarketersShop.indexOf(item.index) == -1
        });
      }
    },
    /** 复选框选中数据 */
    handleMarketersShopSelectionChange(selection) {
      this.checkedMarketersShop = selection.map(item => item.index)
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('marketers/MarketersApply/export', {
        ...this.queryParams
      }, `MarketersApply_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
